<?php
include_once("../DAO/DanhMucDAO.php");
include_once("../DAO/DanhMucDTO.php");
include_once("../DAO/DataHelper.php");
 
 $MucCha = $_GET['MucCha'];
 $MucCon1 = $_GET['MucCon1'];
 $TenDanhMuc = $_GET['TenDanhMuc'];
if($MucCha !='MucCha')
	{
		if( $MucCon1 !='MucCon1')
		{
			$Update = DanhMucDao::CapNhatDanhMuc($TenDanhMuc,$MucCon1);
		}
		$KQ = DanhMucDao::DanhMucCon($MucCha);
		$result = DanhMucDao::HienThiTenDanhMucCon($MucCon1);
		$DanhMucConCap1 = $result->dm_ten;
	}
	else
	{
		$DanhMucConCap1='';
	}
 	echo '<table>';
	echo'	<tr>';
	echo'	  <td width="31%" align="left" bgcolor="#F2F2F2"><strong>Danh Muc Cap 1 : </strong></td>';
	echo'	  <td width="69%" bgcolor="#F2F2F2"><label>';
	echo'		<select name="DanhMucCon" id="DanhMucCon" onchange="HienThiDanhMucCon(this.value)" style="width:385px" >';
			  echo '<option value ="MucCon1">Chon Danh Muc Con 1</option>';
			  if($MucCha !='MucCha')
		{
				 for($i = 0 ; $i < count($KQ) ; $i++)
				{
					$danhmuccon = $KQ[$i];
					echo  "<option value = $danhmuccon->dm_ma> $danhmuccon->dm_ten</option>";
					//echo  "<option> $id</option>";
				}
				}
	echo'	</select>';
	echo'	  </label></td>';
	echo'</tr>';
	echo'</table>';
	
	//	echo'<table width="90%" align="center" id="DanhMucCon1"';
	echo'<table id="DanhMucConCap1">';
	
	echo'	<tr>';
		echo'	  <td width="31%" align="left" bgcolor="#F2F2F2"><strong>Danh Muc Cap 2 : </strong></td>';
		echo'	  <td width="69%" bgcolor="#F2F2F2"><label>';
		echo'		<select name="DanhMucCon1" id="DanhMucCon1" style="width:385px" >';
				  echo '<option value ="MucCon2">Chon Danh Muc Con 2</option>';
		echo'	</select>';
		echo'	  </label></td>';
		echo'</tr>';
	
		//////////////////////////
		echo'<tr>';
		echo '<td width="31%" align="left"><strong>Danh Muc Dang Chon: </strong></td>';
		echo "<td width='69%'><input name='HienThiDanhMuc'id='DanhMucDangChon' type='text'  value='$DanhMucConCap1'  size='70' style='width:380px' /></td>";
		echo'</tr>';
	echo'</table>';
?>